#ifndef WIDGETS_HPP
#define WIDGETS_HPP

#include <QPushButton>
#include <QColor>
#include <QLabel>

namespace TCWidgets {

class TCColorButton : public QPushButton
{
    Q_OBJECT
public:
    TCColorButton(QColor color, QWidget *parent = 0);
    TCColorButton(QPen pen, QWidget *parent = 0);
    void    setColor(QColor);
    void    setColor(QPen);

private:
    void    paintEvent(QPaintEvent *);
    QColor  m_Color;
    QString m_Label;
};

class TCColorSelector : public QWidget
{
    Q_OBJECT
public:
    TCColorSelector(QString label, QColor color, QWidget *parent);
    TCColorSelector(QString label, QPen pen, QWidget *parent);
    void    setColor(QColor);
    void    setColor(QPen);
    QColor  color();

private:
    TCColorButton  *m_Selector;
    QLabel         *m_Label;
    QColor          m_Color;
    void    initialize(QString label, QColor color);

private slots:
    void show_color_dialog();

signals:
    void colorSelected();
};

}

#endif // WIDGETS_HPP
